package com.example.bbs.util;

import java.util.Calendar;
import java.util.Date;

public class TimeUtil {

    /**
     * 获取当前时间倒退一个月的时间
     *
     * @param date
     * @return
     */
    public static Date getLastMonthDate(Date date, int n) {
        Calendar rightNow = Calendar.getInstance();
        rightNow.setTime(date);
        rightNow.add(Calendar.MONTH, -1 * n);
        Date dt1 = rightNow.getTime();
        return dt1;
    }
}
